package com.github.kaelthasbmg.bean;

import java.util.ArrayList;
import java.util.List;

/**
 * 表结构定义
 *
 * @author Carsymor
 */
public class Table {
    /**
     * 表名
     */
    private String tableName;

    /**
     * 列定义
     */
    private List<Column> columns;

    /**
     * 主键定义
     */
    private PrimaryKey primaryKey;

    public String getTableName() {
        return tableName;
    }

    public void setTableName(String tableName) {
        this.tableName = tableName;
    }

    public List<Column> getColumns() {
        return columns;
    }

    public void setColumns(List<Column> columns) {
        this.columns = columns;
    }

    public PrimaryKey getPrimaryKey() {
        return primaryKey;
    }

    public void setPrimaryKey(PrimaryKey primaryKey) {
        this.primaryKey = primaryKey;
    }

    /**
     * 添加列定义
     * @param column 列定义
     */
    public void addColumn(Column column) {
        if (this.columns == null) {
            this.columns = new ArrayList<>();
        }
        this.columns.add(column);
    }
}
